package pl.wroc.pwr.docs.repos.service;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;

import org.hibernate.search.jpa.FullTextQuery;
import org.hibernate.search.query.facet.Facet;
import org.springframework.data.domain.Page;

import pl.wroc.pwr.docs.repos.domain.Document;

public interface DocumentService {
	
	void add(String filename, InputStream in) throws Exception;
	
	void delete(int id);
	
	Document getDocument(int id);
	
	void save(Document doc);
	
	List<Document> getDocuments();
	
	Page<Document> getDocumentsPage(Integer pageNumber);
	
	Page<Document> search(Integer pageNumber, FullTextQuery fullTextQuery);
	
	List<String> getTermsSortedByFrequency(int id) throws IOException;

	FullTextQuery buildQuery(String content);
	
	FullTextQuery filtrQuery(FullTextQuery fullTextQuery, List<String> formats);
	
	FullTextQuery resetQuery(FullTextQuery fullTextQuery);

	List<Facet> getFacets(FullTextQuery fullTextQuery);
	
}
